<script>
	import { log } from './util/helper.js'
	export default {
		async onLaunch() {
			this.stopTouch(); // 禁用双指手势操作缩放与双击缩放
			
			this.$store.commit('global/setSource'); //vuex执行获取当前设备类型的方法
			const type = this.$store.state.global.source;
			if(type == 'ios'){
				console.log('高德地图注册')
				cm.registerWithKey({
					success:function(res){
						console.log(res);
					},
					fail:function(res){
						console.log(res)
					}
				})
			}
		},
		methods:{
			stopTouch(){
				// 禁用双指手势操作缩放
				window.onload=function () {
					try {
						// 禁用双击缩放
						document.addEventListener("touchstart", function(event) {
							if (event.touches.length > 1) {
							  event.preventDefault();
							}
						});
						var lastTouchEnd = 0;
						document.addEventListener(
							"touchend",
							function(event) {
								var now = new Date().getTime();
								if (now - lastTouchEnd <= 300) {
									event.preventDefault();
								}
								lastTouchEnd = now;
							},
							false
						);
						// 禁用双指手势操作
						document.addEventListener("gesturestart", function(event) {
							event.preventDefault();
						});
					} catch (error) {console.log(error)}
				};
			}
		},
		onShow: function() {

		},
		onHide: function() {

		},
		onError(err) {
			log.reportApi(err)
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	page{
		height: 100%;
	}
	//ios系统会默认你的input字体大小不得小于16px，要是小于16px系统就会给你放大页面
	input{
		font-size: 32rpx !important;
	}
	/*每个页面公共css */
	.g-border {
		border: 1px solid #e6e6e6;
	}
	.g-border-bottom {
		border-bottom: 1px solid #e6e6e6;
	}
	.g-border-top {
		border-top: 1px solid #e6e6e6;
	}
	.g-border-left {
		border-left: 1px solid #e6e6e6;
	}
	.g-border-right {
		border-right: 1px solid #e6e6e6;
	}
	@media screen and (-webkit-min-device-pixel-ratio: 2) {
	    .g-border {
	    	border: .5px solid #e6e6e6;
	    }
	    .g-border-bottom {
	    	border-bottom: .5px solid #e6e6e6;
	    }
	    .g-border-top {
	    	border-top: .5px solid #e6e6e6;
	    }
	    .g-border-left {
	    	border-left: .5px solid #e6e6e6;
	    }
	    .g-border-right {
	    	border-right: .5px solid #e6e6e6;
	    }
	}
	@media screen and (-webkit-min-device-pixel-ratio: 3) {
		.g-border {
			border: .5px solid #e6e6e6;
		}
		.g-border-bottom {
			border-bottom: .5px solid #e6e6e6;
		}
		.g-border-top {
			border-top: .5px solid #e6e6e6;
		}
		.g-border-left {
			border-left: .5px solid #e6e6e6;
		}
		.g-border-right {
			border-right: .5px solid #e6e6e6;
		}
	}
</style>
